package br.com.rrf;

import java.util.List;

import br.com.rrf.AdapterTelaVisualizarPedido.ViewHolder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class AdapterTelaDetalhePedido extends BaseAdapter {

	private List<Item> items;
	
	public AdapterTelaDetalhePedido(List<Item> items) {
		this.items = items;	
	}
	@Override
	public int getCount() {
		
		return items.size();
	}

	@Override
	public Object getItem(int position) {
		
		return items.get(position);
	}

	@Override
	public long getItemId(int position) {
		
		return items.get(position).getId();
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
		
		Item item = items.get(position);
		ViewHolder holder;
		
		View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_detalhe_pedido, null);  
		
		holder = new ViewHolder();		
		
		holder.descricao = (TextView)v.findViewById(R.id.textViewDescricaoItem);	
		holder.QuantidadeItem = (TextView)v.findViewById(R.id.textViewQtdItem);
		holder.ValorItem = (TextView)v.findViewById(R.id.textViewValorItem);
		
		
		holder.descricao.setText(item.getProduto().getNome());
		holder.QuantidadeItem.setText("Quantidade:"+item.getQtd());
		holder.ValorItem.setText("		Valor:"+item.getProduto().getValor());
		//holder.descricao.setTag(position);
		return v;
			
		
	}
	
	
	static class ViewHolder {
		TextView ValorItem;
		TextView QuantidadeItem;
		TextView descricao;
		double vTotal;
		View v2;
		
	}

}
